/*
Copyright [2020] [https://www.xiaonuo.vip]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：

1.请不要删除和修改根目录下的LICENSE文件。
2.请不要删除和修改Snowy源码头部的版权声明。
3.请保留源码和相关描述文件的项目出处，作者声明等。
4.分发源码时候，请注明软件出处 https://gitee.com/xiaonuobase/snowy-layui
5.在修改包名，模块名称，项目代码等时，请注明软件出处 https://gitee.com/xiaonuobase/snowy-layui
6.若您的项目无法满足以上几点，可申请商业授权，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package vip.xiaonuo.modular.hallroomjoint.controller;

import org.springframework.web.bind.annotation.*;
import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.annotion.DataScope;
import vip.xiaonuo.core.annotion.Permission;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.core.pojo.response.ResponseData;
import vip.xiaonuo.core.pojo.response.SuccessResponseData;
import vip.xiaonuo.modular.hallroomjoint.entity.HallRoomJoint;
import vip.xiaonuo.modular.hallroomjoint.param.HallRoomJointParam;
import vip.xiaonuo.modular.hallroomjoint.service.HallRoomJointService;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.modular.order.param.OrderParam;
import vip.xiaonuo.sys.modular.org.param.SysOrgParam;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 联席管理控制器
 *
 * @author SunRui
 * @date 2022-02-09 23:32:09
 */
@Controller
public class HallRoomJointController {

    private String PATH_PREFIX = "hallRoomJoint/";

    @Resource
    private HallRoomJointService hallRoomJointService;

    /**
     * 联席管理页面
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
//    @Permission
    @GetMapping("/hallRoomJoint/index")
    public String index() {
        return PATH_PREFIX + "index.html";
    }

//    @Permission
    @GetMapping("/hallRoomJoint/order")
    public String order() {
        return PATH_PREFIX + "order.html";
    }

    /**
     * 联席管理列表
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
//    @Permission
    @ResponseBody
    @GetMapping("/hallRoomJoint/shuju")
    @BusinessLog(title = "点菜", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData shuju(HallRoomJointParam hallRoomJointParam) {
        return new SuccessResponseData(hallRoomJointService.shuju(hallRoomJointParam));
    }

    /**
     * 联席管理表单页面
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
    @GetMapping("/hallRoomJoint/form")
    public String form() {
        return PATH_PREFIX + "form.html";
    }

    @GetMapping("/hallRoomJoint/formorder")
    public String formorder() {

        return PATH_PREFIX + "formorder.html";
    }

    @GetMapping("/hallRoomJoint/formbill")
    public String formbill() {

        return PATH_PREFIX + "formbill.html";
    }


    /**
     * 查询联席管理
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
//    @Permission
    @ResponseBody
    @GetMapping("/hallRoomJoint/page")
    @BusinessLog(title = "联席管理_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public PageResult<HallRoomJoint> page(HallRoomJointParam hallRoomJointParam) {
        return hallRoomJointService.page(hallRoomJointParam);
    }

    /**
     * 添加联席管理
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
//    @Permission
    @ResponseBody
    @PostMapping("/hallRoomJoint/add")
    @BusinessLog(title = "联席管理_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(HallRoomJointParam.add.class) HallRoomJointParam hallRoomJointParam) {
        hallRoomJointService.add(hallRoomJointParam);
        return new SuccessResponseData();
    }

//    @Permission
    @ResponseBody
    @GetMapping("/hallRoomJoint/setIsOrder/{id}")
    @BusinessLog(title = "联席管理_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData setIsOrder(@PathVariable Long id) {
        hallRoomJointService.setIsOrder(id);
        return new SuccessResponseData();
    }

//    @Permission
    @ResponseBody
    @GetMapping("/hallRoomJoint/setStatus/{id}")
    @BusinessLog(title = "联席管理_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData setStatus(@PathVariable Long id) {
        hallRoomJointService.setStatus0(id);
        return new SuccessResponseData();
    }

//    @Permission
    @ResponseBody
    @GetMapping("/hallRoomJoint/setHallSum/{id}/{hallsum}")
    public ResponseData setHallSum(@PathVariable Long id ,@PathVariable("hallsum") String hallsum) {

        hallRoomJointService.setHallSum(id,hallsum);
        return new SuccessResponseData();
    }

    /**
     * 删除联席管理
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
//    @Permission
    @ResponseBody
    @PostMapping("/hallRoomJoint/delete")
    @BusinessLog(title = "联席管理_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(HallRoomJointParam.delete.class) List<HallRoomJointParam> hallRoomJointParamList) {
        hallRoomJointService.delete(hallRoomJointParamList);
        return new SuccessResponseData();
    }

    /**
     * 编辑联席管理
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
//    @Permission
    @ResponseBody
    @PostMapping("/hallRoomJoint/edit")
    @BusinessLog(title = "联席管理_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(HallRoomJointParam.edit.class) HallRoomJointParam hallRoomJointParam) {
        hallRoomJointService.edit(hallRoomJointParam);
        return new SuccessResponseData();
    }

    /**
     * 查看联席管理
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
//    @Permission
    @ResponseBody
    @GetMapping("/hallRoomJoint/detail")
    @BusinessLog(title = "联席管理_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(HallRoomJointParam.detail.class) HallRoomJointParam hallRoomJointParam) {
        return new SuccessResponseData(hallRoomJointService.detail(hallRoomJointParam));
    }

    /**
     * 联席管理列表
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
//    @Permission
    @ResponseBody
    @GetMapping("/hallRoomJoint/list")
    @BusinessLog(title = "联席管理_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(HallRoomJointParam hallRoomJointParam) {
        return new SuccessResponseData(hallRoomJointService.list(hallRoomJointParam));
    }
    /**
     * 获取组织机构树
     *
     * @author SunRui
     * @date 2022-02-09 23:32:09
     */
//    @Permission
    @ResponseBody
    @GetMapping("/hallRoomJoint/tree")
    @BusinessLog(title = "联席管理_树", opType = LogAnnotionOpTypeEnum.TREE)
    public ResponseData tree(HallRoomJointParam hallRoomJointParam) {
        return new SuccessResponseData(hallRoomJointService.tree(hallRoomJointParam));
    }
}
